using System;
using O1.Social.Newsgator.Data;
using O1.Social.Newsgator.Domain.Interfaces;

namespace O1.Social.Newsgator.Repository.LinqToSql
{
    public class ActivityEventConverter : Converter<IActivityEvent, ActivityEvent> {
        #region Overrides of Converter<IActivityEvent,ActivityEvent>

        public override Func<ActivityEvent, IActivityEvent> Convert
        {
            get
            {
                return
                    linq =>
                        {
                            var item = new Domain.ActivityEvent
                                           {
                                               Id = (int) linq.EventId,
                                               ActivityTypeId = (int) linq.ActivityTypeId,
                                               Date = linq.Date,
                                               EntryText = linq.EntryText,
                                               UserId = (int) linq.UserId,
                                           };
                            Update(item, linq);
                            return item;
                    };

            }
        }

        public override Action<IActivityEvent, ActivityEvent> ConvertBack
        {
            get { throw new NotImplementedException(); }
        }

        public override Action<IActivityEvent, ActivityEvent> Update
        {
            get
            {
                return (poco, linq) => { };
            }
        }

      

        #endregion
    }
}